﻿using ShineTech.Domain.SeedWork;
using System;
using System.Collections.Generic;
using System.Linq;

namespace ShineTech.Domain.Models.Kanbans
{
    public class KanbansByFiltersSpecification : SpecificationBase<Kanban>
    {
        public KanbansByFiltersSpecification(string name, Guid? userId, List<Guid> kanbanIds)
            : base(t => t.Name.Contains(name)
            && (!userId.HasValue || t.CreatedUserId == userId)
            && (!kanbanIds.Any() || kanbanIds.Contains(t.Id))
            )
        {

            AddInclude(t => t.Missons);
        }
    }

    public class KanbanByIdSpecification : SpecificationBase<Kanban>
    {
        public KanbanByIdSpecification(Guid id)
            : base(t => t.Id == id)
        {
            AddInclude(t => t.Missons);

        }
    }


    public class KanbanByIdWithMissonsSpecification : SpecificationBase<Kanban>
    {
        public KanbanByIdWithMissonsSpecification(Guid id)
            : base(t => t.Id == id)
        {
            AddInclude(t => t.Missons);
        }
    }
}
